<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="c"       uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page isELIgnored="false"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <base href="<%=basePath%>" />
     <meta http-equiv="content-Type" content="text/html; charset=utf-8" />
    <title>tueye发表文章-tueye发表文章-就爱看图网</title>
	<meta http-equiv="pragma" content="no-cache" />
	<meta http-equiv="cache-control" content="no-cache" />
	<meta http-equiv="expires" content="0" />    
	<meta http-equiv="keywords" content="发表图片文章,图文并茂" />
	<meta http-equiv="description" content="发表图片文章入口" />
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	  <link href="<%=path %>/script/jLook/templates/default/default.css" rel="stylesheet" type="text/css" />
      <link href="<%=path %>/themes/css/index.css" rel="stylesheet" type="text/css" />
      <link href="<%=path %>/themes/css/v1.0/headandfooter1.css" rel="stylesheet" type="text/css" />
      <link href="<%=path %>/themes/css/v1.0/fabuye.css" rel="stylesheet" type="text/css" />
 	 
   <script type="text/javascript" src="<%=path %>/script/jquery.js"></script>
   
   <script type="text/javascript">
    var ifsubmit = false;
    var num = 0;
	 $(document).ready(function(){
		  
		 
		 
	     $("#tijiao").hover(
	       function() { 
              $(this).addClass("addit_over"); 
            },
           function() { 
            $(this).removeClass("addit_over");
              
            });
            
      
            
		 $("input").blur(
		 function(){ 
		   var id = $(this).attr("id");
		   if(id == 'topic_title'){
		     if($(this).attr("value") == null || $(this).attr("value") == '')
		     {  
		        ifsubmit = false;
		       $("#titletip").html("<font color='red'>文章标题不能为空</font>"); 
		     }
		     else{ 
		        ifsubmit = true;
		        $("#titletip").html("");
		      }
		   }
		    if(id == 'topic_overview'){
		     if($(this).attr("value") == null || $(this).attr("value") == '')
		     {  
		       alert();
		        ifsubmit = false;
		       $("#overviewtip").html("<font color='red'>文章概述不能为空</font>"); 
		     }
		     else{ 
		       ifsubmit = true;
		        alert();
		       $("#overviewtip").html("");
		      }
		 
		    } 
		   
		    if(id == 'radio3'){
               alert($('input[@name=publi][@checked]').val());
		 
		    }
            if(id == 'topic_code'){
		     if($(this).attr("value") == null || $(this).attr("value") == '')
		     {  
		        ifsubmit = false;
		       $("#valiedcode").html("<font color='red'>&nbsp;&nbsp;&nbsp;&nbsp;验证码不能为空</font>"); 
		     }
		     else{ 
		        ifsubmit = true;
		        $("#valiedcode").html("");
		      }
		 
		    } 
		   }
		 );
		 
		  
		  
		 } 
		 );
		 
		 function checkform(){  
		   if(ifsubmit=true){
		      if($('#topic_type').val()==0){
		      $('#topic_typetip').html("<font color='red'>请选择文章类型</font>"); 
		      return false;
		   }else{
		   $('#topic_typetip').html("");
		   return true;
		   }
		   }else{
		 	return false;
		 	 }
		 	
		 }
		function refrash(){
		$('#imgId')[0].src+='?'+Math.floor(Math.random()*10);
		}
		function fillzhuanti(){
		 //获得当前选中的类型
		  var type_id = $('#topic_type').val();
		  //发送请求
		  if(type_id != 0){
		  	$.ajax({
			 		type: "POST",
			 		url: "<%=path %>/article.do?action=queryArticle",
			 		data:"id="+type_id,
			 		success: function(msg){ 
			 			if(msg.length > 10 ){
				 			eval("var articledata ="+msg);
				 			 var article =  articledata.article;
				 			// 清一下专题标签 each 选出所有的子项，并删除
				 		 	$("#zhuanti option").each(function(i){
				 		      $(this).remove();
				 		    });
				 		   var 	parSelect="<option value='' >请选择</option>";
				 			
				 			 for(tdata in article){
				 			    
				 			   parSelect +="<option value='"+article[tdata].id +"'>" + article[tdata].name +"</option>"
				 			   
				 			 }
				 			 $('#zhuanti').append(parSelect); 
					 		}
					 }
			});
		   }
		}
  </script>
  </head>
  <body>
  	<div id="box"> 
  <%@ include file="./common/header.jsp" %>
<div id="container">
	<div id="coentaner">
			 <span id="textyans">图片文章基本信息上传</span>
			 <img style="float:right; margin:20px 110px 0 0;"src="<%=path %>/themes/images/photo1.jpg" />
			 <div id="column">
			 	提示:<br /><br />
					 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1.标题前加*的为必填项<br /><br />
      				 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2.文章作者不填写默写了发布者妮称。

			 </div>
			 <div id="column-1">
			 	<form style="float:left;" name="publsihtopic" id="publsihtopic" action="publish_process.do" onsubmit="return checkform();" >
					<span class="cool">*</span>文章标题 ：
					<input type="text"name="topic_title" id="topic_title" value="${topic_title }" class="biaodan4">
					<span id="titletip"></span>
					<br/>
					<br/>
					<span class="cool">*</span>文章概述 ：
					<textarea rows="6" cols="36" class="biaodan3" name="topic_overview" id="topic_overview" >${topic_overview }</textarea>
					<span id="overviewtip"></span>
					<br/>
					<br/>
					<span class="cool">*</span>文章类别 ：
					<select name="topic_type" id="topic_type"  class="main5" onchange="fillzhuanti()" >
							<option value="0">--请选择--</option>
                      <c:forEach var="type" items="${types}">
                          <option value="${type.id}">${type.type_name }</option>
                     </c:forEach>
						</select>
						<span id="topic_typetip"></span>
					<br/>
					<br/>
					<span class="cool">*</span>文章专题 ：
					<select name="zhuanti" id="zhuanti"  class="main5" >
							<option value="0">--请选择--</option>
                      
						</select>
						<span id="zhuantitip"></span>
					<br/>
					<br/>
					&nbsp;&nbsp;&nbsp;&nbsp;文章作者 ：
					<input type="text" name="topic_author" id="topic_author"  value="${topic_author }" class="biaodan1">
					<br/>
					<br/>
					&nbsp;&nbsp;&nbsp;&nbsp;文章转自 ：
					<input type="text" name="topic_from" id="topic_from"  class="biaodan1">
					<br/>
					<br/>
					<span class="cool">*</span>验证码&nbsp;&nbsp;&nbsp;：
					<input type="text" name="topic_code" id="topic_code" class="biaodan1">
					<img  id ='imgId' src="<%=path %>/servlet/createimage" onclick="this.src+='?'+Math.floor(Math.random()*10);" alt="点击刷新" />点图<a class="link1" href ="javascript:refrash()">刷新</a> 
					<span id="valiedcode"></span>
					<br/>
					<br/>
					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					<input type="submit" value="提交信息"/>
			 	</form>
			 </div>
		</div>

  <%@ include file="./common/footer.jsp" %>
  </div>
</body>
</html>
